/* #include <stdio.h>
void exchange (int a, int b, int temp)
{
    temp = a;
    a = b;
    b = temp;

}
当实参传递给形参的时候，实参是形参的一份临时拷贝
对形参的修改不能改变实参
//得用指针
int main()
{
    int x, y;
    scanf("%d %d", &x, &y);
    printf("%d %d", x, y);
    exchange(x, y, 0);
    printf("%d %d", x, y);
    return 0;

} */
// 利用指针交换两个变量的值
#include <stdio.h>

void swap(int* px, int* py)
{
    int z = *px;
    *px = *py;
    *py = z;

}
int main()
{
    int a = 0;
    int b  = 0;
    scanf("%d %d", &a, &b);
    int* p1 = &a;
    int* p2 = &b;
    printf("%d %d\n", *p1, *p2);
    //交换两个整数的值
    swap(&a, &b);
    printf("%d %d\n", *p1, *p2);


    return 0;
}